<template>
	<view>
		<page-head :title="'明细'" :headtype="2"></page-head>
		<view class="discountnav flex marginAuto">
			<view class="discouneach" @click="navtagfun(101)" :class="navtag == 101 ? 'activedis':''">提现</view>
			<view class="discouneach" @click="navtagfun(1)" :class="navtag == 1 ? 'activedis':''" style="margin-left:50rpx;">收益</view>
		</view>
		<view class="recoblock">
			<view class="recoitem blockbg marginAuto" v-for="(item,index) in mxdata" :key="index">
				<view class="recoiteml">
					<!-- <view class="recoiteml-title" style="color:#F03030;">提现失败</view> -->
					<!-- <view class="recoiteml-title" style="color:#1963F7;">审核中</view> -->
					<view class="recoiteml-title">{{ item.remark }}</view>
					<view class="recoiteml-time">{{ item.create_time }}</view>
				</view>
				<view class="recoitemr">{{ navtag > 100 ? '-':'+' }}{{ item.amount }}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				URLimg:this.URLimg,
				page:1,
				navtag:101,
				mxdata:[]
			};
		},
		onLoad() {
			this.URLimg = this.apifun.URLimg;
			this.initData()
		},
		methods: {
			initData(){
				let sendData = {
					page:this.page,
					type:this.navtag
				};
				this.apifun.unirequest('/api/User/balanceRecord','post',sendData,(res)=>{
					// console.log(res)
					if(res.code === 200){
						let datas = res.data;
						if(datas.data.data.length <= 0){
							this.page--
							return false
						}
						this.mxdata.push(...datas.data.data);
					}else{
						this.apifun.toast(res.msg)
					}
				})
			},
			navtagfun(type){
				if(type == this.navtag) return false;
				this.navtag = type;
				this.page = 1;
				this.mxdata = [];
				this.initData();
			},
		},
		onReachBottom() {
			this.page++;
			this.initData();
		},
		onPullDownRefresh() {
			this.page = 1;
			this.mxdata = [];
			this.initData();
			uni.stopPullDownRefresh();
		},
	};
</script>

<style scoped lang="scss">
	page{
		padding-bottom: 150rpx;
	}
	.blockbg {
		width: 640rpx;
		border-radius: 20rpx;
		background-color: #fff;
		padding: 24rpx;
		margin-top: 20rpx;
	}
	.discountnav{
		width: 680rpx;
		height:74rpx;
		.discouneach{
			line-height: 74rpx;
			color:#666666;
			font-size: 30rpx;
		}
		.activedis{
			color:#9E190F;
		}
	}
	.recoblock{
		.recoitem{
			margin-top:20rpx;
			display:flex;
			justify-content: space-between;
			.recoiteml-title{
				font-size: 30rpx;
				color:#333333;
			}
			.recoiteml-time{
				font-size:24rpx;
				color: #9E9E9E;
				line-height: 44rpx;
			}
			.recoitemr{
				margin-top: 18rpx;
				font-size:40rpx;
				color:#333333;
			}
		}
	}
</style>